import request from '@/api/request'

//查询商品列表
function productsByPage(start,limit,data) {
  return request({
    url: `/lejuAdmin/product/productsByPage/${start}/${limit}`,
    method:"POST",
    data
  })
}
//查询品牌列表
function findAllBrand(data) {
  return request({
    url: '/lejuAdmin/brand/findAllBrand',
    data
  })
}
//更改是否最新
function switchNewStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchNewStatus',
    method:"POST",
    data
  })
}
//更改是否推荐
function switchRecommandStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchRecommandStatus',
    method:"POST",
    data
  })
}
//更改发布状态
function switchPublishStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchPublishStatus',
    method:"POST",
    data
  })
}
//更改审核状态
function switchVerifyStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchVerifyStatus',
    method:"POST",
    data
  })
}
//删除商品信息
function del(id,data) {
  return request({
    url: `/lejuAdmin/product/del/${id}`,
    method:"DELETE",
    data
  })
}

//添加商品信息
function addProductAndSkus(data) {
  return request({
    url: '/lejuAdmin/product/addProductAndSkus',
    method:"POST",
    data
  })
}

//查询商品明细，用于编辑
function productSkusDetail(productId,data) {
  return request({
    url: `/lejuAdmin/product/productSkusDetail/${productId}`,
    data
  })
}

//更新商品信息
function updateProductAndSkus(data) {
  return request({
    url: `/lejuAdmin/product/updateProductAndSkus`,
    method:"POST",
    data
  })
}

//删除库存信息
function delSku(id,data) {
  return request({
    url: `/lejuAdmin/sku/delSku/${id}`,
    method:"DELETE",
    data
  })
}
//更新库存信息
function updateSkuInfo(data) {
  return request({
    url: `/lejuAdmin/sku/updateSkuInfo`,
    method:"POST",
    data
  })
}

//根据商品添加库存信息
function addProductSkus(data) {
  return request({
    url: `/lejuAdmin/sku/addProductSkus`,
    method:"POST",
    data
  })
}

export{
  productsByPage,switchNewStatus,switchRecommandStatus,switchPublishStatus,
  switchVerifyStatus,del,findAllBrand,addProductAndSkus,productSkusDetail,updateProductAndSkus,
  delSku,updateSkuInfo,addProductSkus
}